package com.kaizzi.data.jdl.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kaizzi.data.common.been.TempBeen;
import com.kaizzi.data.jdl.entity.OrderList;
import com.kaizzi.data.jdl.mapper.OrderListMapper;
import com.kaizzi.data.jdl.service.JdlNumService;
import com.kaizzi.data.jdl.service.OrderListService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Kzen
 * @Description description
 * @date 2020/9/11
 */
@Slf4j
@Service
public class OrderListServiceImpl extends ServiceImpl<OrderListMapper, OrderList> implements OrderListService {

    @Resource
    private OrderListMapper orderListMapper;
    @Resource
    private JdlNumService jdlNumService;

    @Override
    @DS("jdl_view")
    public long getOrderUser(String startDate, String endDate) {
        Long orderUser = orderListMapper.getOrderUser(startDate, endDate);
        return jdlNumService.transNum(orderUser);
    }

    @Override
    @DS("jdl_view")
    public long getExchangeUser(String startDate, String endDate) {
        Long exchangeUser = orderListMapper.getExchangeUser(startDate, endDate);
        return jdlNumService.transNum(exchangeUser);
    }

    @Override
    @DS("jdl_view")
    public List<TempBeen> getPrdLave(String startDate, String endDate) {
        return orderListMapper.getPrdLave(startDate,endDate);
    }

    @Override
    @DS("jdl_view")
    public long getSingleLave(String prdId, String endDate) {
        Long singleLave = orderListMapper.getSingleLave(prdId, endDate);
        return jdlNumService.transNum(singleLave);
    }

}
